<template>
  <div id="app">
    <header class="head">
          <a class="back tl" href="javascript:history.back(-1)">
          <i class="el-icon-arrow-left"></i>
          </a>
          <a href="javascript:;" class="tc">
            <small class="font_18 co_f">库存记录</small>
          </a>
          <a href="javascript:;" class="tr">
            <small class="font_18 co_f"></small>
          </a>	
    </header> 
    <main>
       <div class="formcontent">
          <ul>
          <li>
              <span><em>*</em>食品类型 </span>
              <div class="froms">
                 <label></label>            
              </div>
            </li>
            <li>
              <span> <em>*</em>食品类别</span>
              <div class="froms">
                 <label></label>            
              </div>
            </li>
            <li>
              <span> <em>*</em>食品名称</span>
              <div class="froms">
                 <label>{{listData[0].demandWarehouse.name}}</label>            
              </div>
            </li>
            <li>
              <span><em>*</em>品牌 </span>
              <div class="froms">
                 <label>{{listData[0].brand}}</label>            
                
              </div>
            </li>
            <li>
              <span><em>*</em>规格净含量 </span>
              <div class="froms">
                 <label>{{listData[0].norms}}</label>
               
              </div>
            </li>
             <li>
              <span>  <em>*</em>生产日期生产批号</span>
              <div class="froms">
                  <label>{{listData[0].productionDate}}</label> 
                
              </div>
            </li>
               <li>
              <span> <em>*</em>有效期限</span>
              <div class="froms">
                 <label>{{listData[0].deadlineDate}}</label>
              </div>
            </li>
             <li>
              <span><em>*</em>生厂商</span>
              <div class="froms">
                  <label>{{listData[0].producers}}</label>
              </div>
            </li>
             <li>
              <span><em>*</em>供应商</span>
              <div class="froms">
                  <label>{{listData[0].supplier.supplierName}}</label>  
              </div>
            </li>
             <li>
              <span><em>*</em>库存数量</span>
              <div class="froms">
                  <label>{{listData[0].inventory}}</label>
              </div>
            </li>
             <li>
              <span><em>*</em>数量单位</span>
              <div class="froms">
                 <label>{{listData[0].unit}}</label> 
              </div>
            </li>
             <li>
              <span> <em>*</em>进货日期 </span>
              <div class="froms">
                 <label>{{listData[0].stockDate|time}}</label>
              </div>
            </li>
          </ul>
       </div>
    </main>
  </div>
</template>

<script>
 import {AbandonStandingDelete} from '../../api/api';
  import {DemandCertificate} from '../../api/api';
  export default {
    data() {
      return {
        listData:[],
        show: false, //默认隐藏
        name:'',
      };
    },
    methods: {
      //数据加载方法   id: this.$route.query.unid,
      getData() {
        //定义需要传给通讯的参数： unid    
       this.PageSize= 1;
        //定义需要传给通讯的参数：QueryData{"PageSize":10,"CurrentPage":1,"Query":{"CriteriaList":[]}}和userunid    
        let varCriteriaList={
            Name: 'Unid',
            Value:this.$route.query.unid,
            Operate: 'Equal',
            DataType: null,
            EndSuffix: '',
            Suffix: null
        }
        let varQueryData = {
          PageSize: this.PageSize,
          CurrentPage: 1,
          Query: {
                 CriteriaList:[],
          }
        }
        varQueryData.Query.CriteriaList.push(varCriteriaList)//往数组里面添加对象
        let options = {
          params: {
            UserUnid: JSON.parse(localStorage.getItem('auth')).UserUnid,
            QueryData: JSON.stringify(varQueryData)
          }
        }
        //调取接口
        DemandCertificate(options).then((res) => {
          if (res.success === true) {
            this.listData = res.data;
            console.log(res.data)
          }
        })
      },
      //删除方法
      handleDelete() {
      let deletParams={
         params: {
            ids: this.$route.query.unid,
          }
      }
       this.$confirm('是否删除此条信息?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
      AbandonStandingDelete(deletParams).then(() => {
          this.getData();
          this.$message({
            message: '删除成功',
            type: 'success'
          });
           this.$router.push({ name: 'Fqwgllist' });
        });
      });
    },

    },
    created() {
      this.getData();
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>

</style>
